all: simulator assembler debugger

assembler-grammar.o: assembler-grammar.c
	gcc -O1 -c assembler-grammar.c

assembler-grammar.c: assembler-grammar.lex
	flex assembler-grammar.lex
	mv lex.yy.c assembler-grammar.c

assembler.o: assembler.c assembler.h isa.h
	gcc -Wall -O1 -g -c assembler.c

assembler: assembler-grammar.o assembler.o
	gcc -Wall -O1 -g assembler-grammar.o assembler.o -lfl -o assembler

simulator.o: simulator.c isa.h
	gcc -Wall -O1 -g -c simulator.c

simulator: simulator.o
	gcc -Wall -O1 -g simulator.o -o simulator

debugger.o: debugger.c isa.h
	gcc -Wall -O1 -g -c debugger.c

debugger: debugger.o
	gcc -Wall -O1 -g debugger.o -o debugger

clean:
	rm -f *.o assembler simulator debugger lex.yy.c assembler-grammar.c test-case/*.o
